from pymysql import Connection

con = Connection(
    host="localhost",
    port=3306,
    user="root",
    password="123456",
    # autocommit=True
)

# print(con.get_server_info())
#获取游标对象
cursor = con.cursor()
#选择数据库
con.select_db("test")
#执行sql
# cursor.execute("create table test_pymysql(id int)")

#获取查询结果
# cursor.execute("select * from employees")
# result:tuple = cursor.fetchall()
# print(result)

#插入
cursor.execute("insert into test_pymysql values(11)")
#使用commit提交
con.commit()


con.close()
